Windows 7 comes with a utility called Disk
Defragmenter that’s an essential tool for tuning your hard disk. Disk
Defragmenter’s job is to rid your hard disk of file fragmentation.
File fragmentation
is one of those terms that sounds scarier than it actually is. It
simply means that a file is stored on your hard disk in scattered,
noncontiguous bits. This is a performance drag because it means that
when Windows 7 tries to open such a file, it must make several stops to
collect the various pieces. If a lot of files are fragmented, it can
slow even the fastest hard disk to a crawl.
Why
doesn’t Windows 7 just store files contiguously? Recall that Windows 7
stores files on disk in clusters, and that these clusters have a fixed
size, depending on the disk’s capacity. Recall, too, that Windows 7
uses a file directory to keep track of each file’s whereabouts. When
you delete a file, Windows 7 doesn’t actually clean out the clusters
associated with the file. Instead, it just marks the deleted file’s
clusters as unused.
To see how fragmentation occurs, let’s look at an example. Suppose that three files—FIRST.TXT, SECOND.TXT, and THIRD.TXT—are stored on a disk and that they use up four, three, and five clusters, respectively. Figure 1 shows how they might look on the disk.
If you now delete SECOND.TXT, clusters 5, 6, and 7 become available. But suppose that the next file you save—call it FOURTH.TXT—takes
up five clusters. What happens? Well, Windows 7 looks for the first
available clusters. It finds that 5, 6, and 7 are free, so it uses them
for the first three clusters of FOURTH.TXT. Windows continues and finds that clusters 13 and 14 are free, so it uses them for the final two clusters of FOURTH.TXT. Figure 2 shows how things look now.
As you can see, FOURTH.TXT
is stored noncontiguously—in other words, it’s fragmented. Although a
file fragmented in two pieces isn’t that bad, it’s possible for large
files to split into dozens of blocks.
Running the Disk Defragmenter Tool
The
good news with Windows 7 is that it configures Disk Defragmenter to run
automatically—the default schedule is weekly: every Wednesday at 1:00
a.m. This means that you should never need to defragment your system
manually. However, you might want to run a defragment before loading a
particularly large software program.
Before using Disk Defragmenter, you should perform a couple of housekeeping chores:
Delete
any files from your hard disk that you don’t need, as described in the
previous section. Defragmenting junk files only slows down the whole
process.
Check for file system errors by running Check Disk.
Follow these steps to use Disk Defragmenter:
1. | Select Start, type defrag,
and then click Disk Defragmenter in the search results. Alternatively,
in Windows Explorer, right-click the drive you want to defragment,
click Properties, display the Tools tab in the dialog box that appears,
and then click the Defragment Now button. Either way, the Disk
Defragmenter window appears, as shown in Figure 3.
|
2. | Click the disk you want to defragment.
|
3. | Click Defragment Disk. Windows 7 defragments your hard drives.
|
4. | When the defragment is complete, click Close.
|
Tip
In
some cases, you can defragment a drive even further by running Disk
Defragmenter on the drive twice in a row. (That is, run the defragment,
and when it’s done immediately run a second defragment.)
Changing the Disk Defragmenter Schedule
If
you want to run Disk Defragmenter on a different day, at a different
time, more often or less often, follow these steps to change the
default schedule:
1. | Select Start, type defrag, and then click Disk Defragmenter in the search results.
|
2. | Click Configure Schedule to display the Disk Defragmenter: Modify Schedule dialog box, shown in Figure 4.
|
3. | Make sure that the Run on a Schedule check box is activated.
|
4. | Use the Frequency list to select the defragment frequency: Daily, Weekly, or Monthly.
|
5. | For
a Weekly schedule, use the Day list to select the day of the week on
which to run the defragment; for a Monthly schedule, use the Day list
to select the day of the month on which to run the defragment.
|
6. | Use the Time list to select the time of day to run the defragment.
|
7. | Click OK to return to the Disk Defragmenter window.
|
8. | Click Close.
|
Changing Which Disks Get Defragmented
Disk
Defragmenter also has a feature that enables you to select which disks
get worked on when the program performs its weekly (or whatever)
defragment. This is useful if you have many hard drives or partitions
on your system and you’d like to restrict the ones that Disk
Defragmenter works on to speed things up.
Follow these steps to specify which disks get defragmented:
1. | Select Start, type defrag, and then click Disk Defragmenter in the search results.
|
2. | Click Configure Schedule to display the Disk Defragmenter: Modify Schedule dialog box.
|
3. | Click Select Disks to display the Disk Defragmenter: Select Disks for Schedule dialog box, shown in Figure 5.
|
4. | Deactivate the check box beside any disk that you don’t want defragmented.
|
5. | If
you want Disk Defragmenter to stop adding new disks to the defragment
list, deactivate the Automatically Defragment New Disks check box.
|
6. | Click OK to return to the Disk Defragmenter: Modify Schedule dialog box.
|
7. | Click OK.
|